<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:sec="http://www.springframework.org/security/tags">

<body>

<ui:composition template="/templates/template.xhtml"  xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"  xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">

    <ui:define name="title">
        Member Registration
    </ui:define>
    <ui:define name="body">
        <f:view>
            <sec:authorize access="hasRole('Admin')">
            <h:form>
                <div >
                    <h:panelGrid id="mainGrid" columns="1">
                        <f:facet name="header">
                            <h:outputText value="Member Registration"/>
                        </f:facet>
                        <h:panelGroup>
                            <h:outputLabel value="First name:" for="firstNameTextField" />
                            <h:inputText value="#{memberBean.firstName}" id="firstNameTextField" required="false" requiredMessage="First name is required."/>
                            <h:message for="firstNameTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Middle name:" />
                            <h:inputText value="#{memberBean.middleName}" id="middleNameTextField" required="false"/>
                            <h:message for="middleNameTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Last name:" />
                            <h:inputText value="#{memberBean.lastName}" id="lastNameTextField" required="false" requiredMessage="Last name is required."/>
                            <h:message for="lastNameTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Father's name:" />
                            <h:inputText value="#{memberBean.fatherName}" id="fatherNameTextField" required="false" requiredMessage="Father's name is required."/>
                            <h:message for="fatherNameTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Enter Birthday:" />
                            <h:inputText value="#{memberBean.dob}" id="dobTextField" required="false"  requiredMessage="Birthday is required.">
                                <f:convertDateTime pattern="dd-MMM-yyyy" />
                            </h:inputText> (dd-MMM-yyyy)
                            <h:message for="dobTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Enter Phone number:" />
                            <h:inputText value="#{memberBean.phoneNumber}" id="phoneNumberTextField" required="false"  requiredMessage="Phone number is required.">
                                <f:validator validatorId="PhoneNumberValidator" />
                            </h:inputText>
                            <h:message for="phoneNumberTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Email ID:" />
                            <h:inputText value="#{memberBean.emailId}" id="emailIdTextField"/>
                            <h:message for="emailIdTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="ID Card No:" />
                            <h:inputText value="#{memberBean.idCardNo}" id="idCardNoTextField" required="false" requiredMessage="ID Card No is required."/>
                            <h:message for="idCardNoTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Form No:" />
                            <h:inputText value="#{memberBean.formNo}" id="formNoTextField" required="false" requiredMessage="Form No is required."/>
                            <h:message for="formNoTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Select Member Type:" />
                            <h:selectOneMenu id="memberTypeDropdown" value="#{memberBean.memberTypeCd}" required="false" requiredMessage="Please Select Type" >
                                <f:selectItems value="#{memberBean.memberTypeCdValues}" />
                            </h:selectOneMenu>
                            <h:message for="memberTypeDropdown" errorStyle="color:red" />
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Select Occupation:" />
                            <h:selectOneMenu id="occupationDropdown" value="#{memberBean.occupationCd}" required="false" requiredMessage="Please Select Occupation" >
                                <f:selectItems value="#{memberBean.occupationCdValues}" />
                            </h:selectOneMenu>
                            <h:message for="occupationDropdown" errorStyle="color:red" />
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Select Qualification :" />
                            <h:selectOneMenu id="qualificationDropdown" value="#{memberBean.qualificationCd}" required="false" requiredMessage="Please Select Qualification" >
                                <f:selectItems value="#{memberBean.qualificationCdValues}" />
                            </h:selectOneMenu>
                            <h:message for="qualificationDropdown" errorStyle="color:red" />
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Select State:" />
                            <h:selectOneMenu id="stateDropdown" value="#{memberBean.stateCd}"  >
                                <f:selectItems value="#{memberBean.stateCdValues}" />
                            </h:selectOneMenu>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Select District:" />
                            <h:selectOneMenu id="districtDropdown" value="#{memberBean.districtCd}" required="false" requiredMessage="Please Select District" >
                                <f:selectItems value="#{memberBean.districtCdValues}" />
                            </h:selectOneMenu>
                            <h:message for="districtDropdown"  errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Enter City/Town:"/>
                            <h:inputText value="#{memberBean.townCd}" id="townDropdown" />
                            <h:message for="townDropdown"  errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Enter Block:"/>
                            <h:inputText value="#{memberBean.blockCd}" id="blockDropdown" />
                            <h:message for="blockDropdown"  errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Enter Panchayat:"/>
                            <h:inputText value="#{memberBean.panchayatCd}" id="panchayatDropdown"/>
                            <h:message for="panchayatDropdown"  errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Enter Village:"/>
                            <h:inputText value="#{memberBean.village}" id="villageTextField" />
                            <h:message for="villageTextField"  errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Address Line1:" />
                            <h:inputText value="#{memberBean.addressLine1}" id="addressLine1TextField" required="false" requiredMessage="Address is required."/>
                            <h:message for="addressLine1TextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Address Line2:" />
                            <h:inputText value="#{memberBean.addressLine2}" id="addressLine2TextField" />
                            <h:message for="addressLine2TextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Pin Code:" />
                            <h:inputText value="#{memberBean.pinCode}" id="pinCodeTextField" required="false" requiredMessage="Pin Code is required."/>
                            <h:message for="pinCodeTextField" errorStyle="color:red"/>
                        </h:panelGroup>
                        <h:commandButton value="Submit Values" action="#{memberBean.save()}"/>
                    </h:panelGrid>
                </div>
            </h:form>
            </sec:authorize>
        </f:view>
    </ui:define>
</ui:composition>
</body>
</html>